How To Read File

Petrolib is designed to handle well data stored in different formats. These include: CSV, TXT, LAS (1.0 or 2.0) and XLSX (DLIS, soon). Here, we demonstrate how to load data frm these format using Petrolib modules

Load LASIO file¶

In [6]:
# Importing the load_las function from the petrolib.file_reader module
from petrolib.file_reader import load_las

# Loading data from the LAS file 'ATAGA 10.las' using the load_las function
well_las = load_las('ATAGA 10.las')

# Displaying the loaded data from the LAS file
well_las
Out[6]:
<lasio.las.LASFile at 0x7f205be20e50>

Both the LAS object and DataFrame object can be returned

In [4]:
# Loading data from the LAS file 'ATAGA 10.las' using the load_las function from the petrolib.file_reader module,
# specifying to return a DataFrame (well_df) and CSV file (well_las)
well_df, well_las = load_las('ATAGA 10.las', return_csv=True)

# Displaying the DataFrame containing data from the LAS file
well_df
Out[4]:
DEPT:2 SP DT GR CALI LLS RHOB DRHO ILD SFLU MSFL NPHI
DEPT:1
1080.2112 1080.211182 0.7051 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1080.3636 1080.363648 0.7363 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1080.5160 1080.515991 0.7676 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1080.6684 1080.668457 1.0781 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
1080.8208 1080.820801 1.9189 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ... ... ...
4335.0180 4335.018066 NaN NaN 54.9375 NaN 111696.0 NaN NaN 0.0806 NaN 1.2432 NaN
4335.1704 4335.170410 NaN NaN 54.9375 NaN 111696.0 NaN NaN 0.0806 NaN 1.2432 NaN
4335.3228 4335.322754 NaN NaN 54.9375 NaN 111696.0 NaN NaN 0.0806 NaN 1.2432 NaN
4335.4752 4335.475098 NaN NaN 54.9375 NaN 111696.0 NaN NaN 0.0806 NaN 1.2432 NaN
4335.6276 4335.627441 NaN NaN 54.9375 NaN 111696.0 NaN NaN 0.0806 NaN 1.2432 NaN

21362 rows × 12 columns

You may decide to load in selective log curves. The depth log is automatically loaded in for a LAS file.

In [7]:
# Loading data from the LAS file 'ATAGA 10.las' using the load_las function from the petrolib.file_reader module,
# specifying to return a DataFrame (well_df) and CSV file (well_las), and selecting specific log curves ('GR', 'ILD', 'SP')
well_df, well_las = load_las('ATAGA 10.las', return_csv=True, curves=['GR', 'ILD', 'SP'])

# Displaying the DataFrame containing data from the LAS file
well_df
Out[7]:
GR ILD SP
DEPT:1
1080.2112 NaN NaN 0.7051
1080.3636 NaN NaN 0.7363
1080.5160 NaN NaN 0.7676
1080.6684 NaN NaN 1.0781
1080.8208 NaN NaN 1.9189
... ... ... ...
4335.0180 54.9375 0.0806 NaN
4335.1704 54.9375 0.0806 NaN
4335.3228 54.9375 0.0806 NaN
4335.4752 54.9375 0.0806 NaN
4335.6276 54.9375 0.0806 NaN

21362 rows × 3 columns

Load CSV and TXT¶

In [10]:
# Importing the load_table function from the petrolib.file_reader module
from petrolib.file_reader import load_table

# Loading data from the CSV file 'wellA.csv' using the load_table function from the petrolib.file_reader module,
# specifying the delimiter as ',' and selecting specific log curves ('DEPTH', 'GR', 'RT')
well_df = load_table('wellA.csv', delimiter=',', curves=['DEPTH', 'GR', 'RT'])

# Displaying the DataFrame containing the loaded data
well_df
Out[10]:
DEPTH GR RT
0 5500.0 102.740799 2.5668
1 5500.5 100.633003 2.5882
2 5501.0 101.032898 2.6036
3 5501.5 101.927498 2.6520
4 5502.0 101.630699 2.6885
... ... ... ...
6996 8998.0 91.238297 3.5703
6997 8998.5 87.492203 4.6154
6998 8999.0 80.359398 4.9716
6999 8999.5 75.007797 5.6926
7000 9000.0 77.320297 6.0549

7001 rows × 3 columns